<?php
//用户认证
$api = app('Dingo\Api\Routing\Router');
$api->version('v1', ['middleware' => 'api.throttle', 'limit' => 60, 'expires' => 1], function ($api) {       //多个版本['v1','v2']      可加中间件


    $api->group(['prefix'=>'auth'],function ($api){
        //注册
        $api->post('register',[\App\Http\Controllers\Auth\RegisterController::class,'store']);
        //登录
        $api->post('login',[\App\Http\Controllers\Auth\LoginController::class,'login']);
        //退出登录
        $api->post('logout',[\App\Http\Controllers\Auth\LoginController::class,'logout']);
        //======发邮箱验证码
        $api->post('email/code',[\App\Http\Controllers\Auth\BindContrpller::class,'emailCode']);
        //拿验证码 ===>忘记密码
        $api->post('forget',[\App\Http\Controllers\Auth\ForgetController::class,'forget']);
        //手机号sendcode
        $api->post('phone',[\App\Http\Controllers\Auth\FindController::class,'sendcode']);
        //需要登录的路由
        $api ->group(['middleware'=>'api.auth'],function ($api){
            //验证邮箱验证码====>改密码
            $api->post('email/update',[\App\Http\Controllers\Auth\BindContrpller::class,'updateEmail']);
            //拿oss。token
            $api->post('oss/token',[\App\Http\Controllers\Auth\OssController::class,'token']);
        });
    });

});
